<template>
  <div class="page navpage">
    <div class="layui-tab layui-tab-brief kdlayuitab" lay-filter="docDemoTabBrief" >
      <ul class="layui-tab-title kdlayuitabtitle">
        <li :class="urlname==item.url?'layui-this layui-nav-item':''" v-for="(item,index) in navlist"
          :key="index"  @mouseout="show = -1" @mouseover="navhouver(index)">
          <div @click="tz(item.url)">{{item.name}}</div>
          <dl class="layui-nav-child" v-show=" show == index">
            <dd @click="two(items.url)" v-for="(items,indexs) in twonav" :key="indexs" >{{items.name}}</dd>
          </dl>
          </li>
          
      </ul>
    </div>
  </div>
</template>
<script>
export default {
  name: 'secondnav',
  props: {
    urlname: ''
    
  },
  data () {
    return {
      show: -1,
      title: webtitle,
      navlist: [{ name: '', url: '' }],
      nextlist:[{ name: '', url: '' }],
      twonav: [],

    }
  },
  mounted () {
    this.getnav();
  },
  methods: {

    getnav: function () {
      /*获取导航内容，level -1管理员  其它为商家*/
      var _this = this;
      var type = localStorage.getItem("type");
      if (type == 1) {
        var arr = [{ name: '首页', url: 'index' },
        // { name: '大屏统计系统', url: 'zlgjindex' },
        { name: '用户管理', url: 'user' },
        { name: '商品管理', url: 'shopmall' },
        // { name: '资讯管理', url: 'news' },
        // { name: '营销模版', url: 'market' },
        { name: '交易明细', url: 'amount' },
        // { name: '结算管理', url: 'jiesuan' },
        // { name: '设置', url: 'homepage' }
        ]
        this.navlist = arr;
      }
      else if(type != 1 && _this.title != "物格码"){
        var arr = [{ name: '首页', url: 'index' },
        { name: '用户管理', url: 'user' },
        { name: '商品管理', url: 'shopmall' },
        // { name: '推广管理', url: 'retail' },
        { name: '订单管理', url: 'order' },
        // { name: '资讯管理', url: 'news' },
        // { name: '营销管理', url: 'market' },
        // { name: '结算管理', url: 'jiesuan' }
        ]
        this.navlist = arr;
      } else{
        var arr = [{ name: '首页', url: 'index' },
        { name: '用户管理', url: 'user' },
        { name: '商品管理', url: 'shopmall' },
        { name: '推广管理', url: 'retail' },
        { name: '订单管理', url: 'order' },
        { name: '资讯管理', url: 'news' },
        { name: '营销管理', url: 'market' },
        { name: '商品分润设置', url: 'shoppv' },
        { name: '结算管理', url: 'jiesuan' }
        ]
     
        this.navlist = arr;
      }
      
     
        if(type == 1){
      var parr = [
          [],
          [],
          [
            { name: "用户列表", url: "userlist" },
            { name: "门店列表", url: "shoplist" },
            { name: "门店审核", url: "userset" }
          ],
          [
            { name: "代理列表", url: "daililist" },
            { name: "代理审核", url: "shlist" },
            { name: "代理等级", url: "djlist" },
            { name: "代理升级", url: "sjlist" },
            { name: "代理价格", url: "jglist" },
            { name: "代理设置", url: "setjc" },
          ],
          [
            { name: "栏目列表", url: "newscat" },
            { name: "资讯列表", url: "newslist" },
            { name: "留言管理", url: "newsmessage" }
          ],
          [
            { name: "优惠券", url: "yhj" },
            { name: "会员模板", url: "member" },
          ],
          [
            {name:'充值明细',url:'amountlist'},
            {name:'消费金明细',url:'xfjlist'},
            {name:'消费工分明细',url:'xfgflist'},
            {name:'共享金明细',url:'gxjlist'},
            {name:'WDT明细',url:'wdtlist'},
            {name:'WUC明细',url:'wuclist'},
            {name:'UC明细',url:'uclist'},
            {name:'收支明细',url:'rmblist'},
            // {name:'自洽指数明细',url:'ziqlist'},
            {name:'专项资产明细',url:'zxzclist'},
            {name:'创业指数明细',url:'cylist'},
          ],
          [
            { name: "商城分享(PV)", url: "shoppvset" },
            { name: "活动模版设置", url: "activityset" },
            { name: "开户费设置", url: "gradelist" },
            { name: "代理赠送设置", url: "proxylist" },
            { name: "背景图/二维码设置", url: "bgdlist" },
            // { name: "基础设置", url: "homepagelist" },
            // { name: "店铺设置", url: "shopset" },
            // { name: "运费模版", url: "yfset" },
            // { name: "支付方式", url: "zfset" },
            // { name: "包邮设置", url: "byset" },
            // { name: "发货物流", url: "fhset" },
            // { name: "安全密码设置", url: "pwdset" },
            // { name: "角色管理", url: "jsset" },
            // { name: "用户自提", url: "yhset" },
            // { name: "客户系统", url: "khset" }
          ]
          
        ];
        this.nextlist = parr;
      }else if (type != 1 && _this.title != "物格码") {
        var parr = [
          [],
          [
            { name: "门店列表", url: "storelist" },
            { name: "商家会员", url: "memberlist"},
            { name: "微信参数配置", url: "wechatlist"},
          ],
          [
            { name: "商品管理", url: "shopmallList" },
            { name: "商品经营类目", url: "shopsortlist" },
            { name: "商品分组", url: "shopgrouplist" },
          ],
          [
            { name: "推广奖金设置", url: "commission" },
            { name: "客户管理", url: "customerlist" },
            { name: "推广员管理", url: "promoterlist" },
            { name: "推广订单管理", url: "promoterorder" }
          ],
          [
            { name: "消费订单", url: "xforder" },
            { name: "商城订单", url: "scorder" },
          ],
          [
            { name: "栏目列表", url: "newscat" },
            { name: "资讯列表", url: "newslist" },
            { name: "留言管理", url: "newsmessage" }
          ],
          [
            { name: "优惠券", url: "yhj" },
            { name: "会员营销", url: "member1" }
          ]
        ];
        this.nextlist = parr;
      }else {
        var parr = [
          [],
          [
            { name: "门店列表", url: "storelist" },
            { name: "商家会员", url: "memberlist" },
            { name: "微信平台参数配置", url: "wechatlist"},
          ],
          [
            { name: "(易)商品管理", url: "shopmallList" },
            { name: "(易)商品经营类目", url: "shopsortlist" },
            { name: "(易)商品分组", url: "shopgrouplist" },
            { name: "(uc)商品管理", url: "ucshopmallList" },
            { name: "(uc)商品经营类目", url: "ucshopsortlist" },
            { name: "(uc)商品分组", url: "ucshopgrouplist" },
            { name: "(wuc)商品管理", url: "wucshopmallList" },
            { name: "(wuc)商品经营类目", url: "wucshopsortlist" },
            { name: "(wuc)商品分组", url: "wucshopgrouplist" }
          ],
          [
            { name: "推广奖金设置", url: "commission" },
            { name: "客户管理", url: "customerlist" },
            { name: "推广员管理", url: "promoterlist" },
            { name: "推广订单管理", url: "promoterorder" }
          ],
          [
            { name: "消费订单", url: "xforder" },
            { name: "(易)商城订单", url: "scorder" },
            { name: "(UC)商城订单", url: "ucorder" },
            { name: "(WUC)商城订单", url: "wucorder" }
          ],
          [
            { name: "栏目列表", url: "newscat" },
            { name: "资讯列表", url: "newslist" },
            { name: "留言管理", url: "newsmessage" }
          ],
          [
            { name: "优惠券", url: "yhj" },
            { name: "会员营销", url: "member1" }
          ],
          [
            { name: "商品分享(PV)", url: "shoppvlist" }
          ]
        ];
        this.nextlist = parr;
      }
      
       
        
    },
    navhouver:function(index){
//    var _this = this;
//    var arr=this.nextlist
//    this.twonav=arr[index];
//    _this.show = index;
      // console.log(this.twonav);

    },
    tz: function (url) {
      if (url == 'zlgjindex') {
        let newpage = this.$router.resolve({ name: url })
        window.open(newpage.href, "_blank");
      }
      else {
        this.$router.push({
          name: url
        })
      }
     
    },
    two: function (url) {
        this.$router.push({
          name: url
        })
        // console.log(url);
    }
  },
}
</script>
<style scoped>
.kdlayuitab {
  margin: 0;
}
.kdlayuitab .layui-tab-title {
  margin: 0;
  height: auto;
}
.layui-tab-title li {
  font-size: 16px;
  line-height: 46px;
  height: 46px;
  font-weight: 700;
}
/* .kdlayuitabtitle dl{display:none;} */
.kdlayuitabtitle  dl{display: block;top:40px;font-size: 14px;color: #666;z-index:1000;}

@media screen and (min-width: 320px) and (max-width: 640px) {
  .kdlayuitabtitle {
    overflow-x: scroll;
  }
}
</style>